Array.prototype.myFilter = function(cb) {
    var _arr = this;
    var _len = _arr.length;
    var _arg2 = arguments[1] || window;
    var result = [];
    
    for(var i = 0; i < _len; i++) {
        if (cb.apply(_arg2, [_arr[i], i, _arr])) {
            result.push(_arr[i]);
        }
    }

    return result;
}

function myFilter(cb) {
    var _arr = this;
    var _len = _arr.length;
    var _arg2 = arguments[1] || window;
    var result = [];
    
    for(var i = 0; i < _len; i++) {
        if (cb.apply(_arg2, [_arr[i], i, _arr])) {
            result.push(_arr[i]);
        }
    }
    return result;    
}